#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 crane <crane@gosun>
#
# Distributed under terms of the MIT license.

"""

"""

def myrange(start, end, step=1):
    if step > 0:
        while start < end:
            yield start
            start += step
    elif step < 0:
        while start > end:
            yield start
            start += step
    else:
        raise Exception("step must not be zeor!!!")


def main():
    print("start main")

    for i in myrange(1, 2):
        print(i)

    for i in myrange(1, 1):
        print(i)

    for i in myrange(1, -1):
        print(i)

    for i in myrange(5, 4, -1):
        print(i)

    for i in myrange(10, 4, -1):
        print(i)

if __name__ == "__main__":
    main()
